#include "start.h"
#include <QDateTime>
#include <QFile>
#include <QtGui/qguiapplication.h>
#include <QTextStream>


Start::Start() {

}

Start::~Start() {

}

Start& Start::getInstance()
{
    static Start instance;
    return instance;
}

void Start::writeLog(QString msg)
{
    QDateTime now = QDateTime::currentDateTime();
    QString name = now.toString("yyyy-MM-dd");
    QString fileName = QString("%1/%2.txt").arg(qApp->applicationDirPath(), name);
    QFile file(fileName);
    file.open(QFile::Append | QIODevice::Text);
    QTextStream out(&file);
    out << "["<<now.toString("HH:mm:ss.zzz")<<"] " << msg << QString("\n");
    file.close();
}

